package com.csg.boot.starter.builder;

import com.csg.boot.starter.constant.SwaggerProperties;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ResponseMessage;

/**
 * @author george
 */
public class ResponseMessageBuilder implements BaseBuilder<ResponseMessage, SwaggerProperties.ResponseMessageProperties> {

    private static ResponseMessageBuilder builder = new ResponseMessageBuilder();

    private ResponseMessageBuilder() {
    }

    public static ResponseMessageBuilder getInstance() {
        return builder;
    }

    @Override
    public ResponseMessage build(SwaggerProperties.ResponseMessageProperties properties) {
        return new springfox.documentation.builders.ResponseMessageBuilder()
                .code(properties.getCode())
                .message(properties.getMessage())
                .responseModel(new ModelRef(properties.getModelRef()))
                .build();
    }
}
